#-*-encoding=utf-8-*-
@script_attr(permission='zope.View', use_template='none')
def setup(redirect=True):
    """安装程序

    这是应用的安装程序"""

    # 创建一个flowcenter
    flowcenter = deployApplet('default.flowcenter', context)
    flowcenter.categories1 = (u'文控流程',)
    flowcenter.categories2 = (u'其他流程',)

    flow = deployDataManager(flowcenter, name='review', title='文档审核发布', 
                      edoclass='zopen.isodoc.review', workflow='zopen.isodoc.review')

    IDublinCore(flow).subjects = (u'文控流程', )

    flow = deployDataManager(flowcenter, name='deliver', title='文档分发', 
                      edoclass='zopen.isodoc.delivery', workflow='zopen.isodoc.delivery')

    IDublinCore(flow).subjects = (u'文控流程', )

    flow = deployDataManager(flowcenter, name='return', title='文档收回', 
                      edoclass='zopen.isodoc.return', workflow='zopen.isodoc.return')

    IDublinCore(flow).subjects = (u'其他流程', )

    flow = deployDataManager(flowcenter, name='permission', title='文档权限申请', 
                      edoclass='zopen.isodoc.permission', workflow='zopen.isodoc.permission')

    IDublinCore(flow).subjects = (u'文控流程', )

    flow = deployDataManager(flowcenter, name='destroy', title='文档销毁', 
                      edoclass='zopen.isodoc.destroy', workflow='zopen.isodoc.destroy')

    IDublinCore(flow).subjects = (u'其他流程', )

    if redirect:
        request.response.redirect(absoluteURL(flowcenter, request))

